//
//  KLBasketTableViewCell.m
//  KunLun
//
//  Created by Mac on 2017/11/27.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLInformationTableViewCell.h"
@interface KLInformationTableViewCell()
@property(nonatomic, strong) UIImageView                     *iconImageView;
@property(nonatomic, strong) STLabel                            *titleLable;
@property(nonatomic, strong) STLabel                            *desLable;
@property(nonatomic, strong) STLabel                     *timeLable;
@end
@implementation KLInformationTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self ==[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 110;
}
#pragma mark --subView
- (void)configSubView{
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 5, 100, 100)];
    self.iconImageView.image = [UIImage imageNamed:@"07"];
    [self addSubview:self.iconImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.iconImageView.top + 5, (UIScreenWidth - self.iconImageView.right - 20), 20)
                                                text:@"青菜龙家菜"
                                           textColor:KL_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.titleLable];
    
    self.desLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.titleLable.bottom , (UIScreenWidth - self.iconImageView.right - 20) , 45)
                                                   text:@"距离：0.5km"
                                              textColor:KL_firstTextColor
                                                   font:13
                                            isSizetoFit:NO
                                          textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.desLable];
    
    
    self.timeLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.desLable.bottom + 5, (UIScreenWidth - self.iconImageView.right - 20) - 10, 20)
                                                text:@"青菜龙家菜"
                                           textColor:KL_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentRight];
    self.timeLable.right = UIScreenWidth - 15;
    [self addSubview:self.timeLable];
}
- (void)setModel:(KLInfoModel *)model{
    _model = model;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.feature_image.firstObject]];
    
    self.titleLable.text = model.post_title;
    
    self.desLable.text = model.post_excerpt;
    
    self.timeLable.text = model.create_time;
}
@end

